// 计算 1+2+3+....+n 的和。并判断该数字是奇数还是偶数. 并求阶层
#include <iostream>
using namespace std;

int main() {
    int n, sum = 0;
    cout << "输入一个正整数: ";
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        sum += i;
    }
    cout << "Sum = " << sum;

    // 判断该数字是奇数还是偶数
    cout << "\n" << endl;
    if ( n % 2 == 0)
        cout << n << " 为偶数。";
    else
        cout << n << " 为奇数。";

    // 判断阶层
    cout << "\n" << endl;
    unsigned long long factorial = 1;
    for(int i = 1; i <=n; ++i)
    {
        factorial *= i;
    }
    cout << n << " 的阶乘为："<< " = " << factorial;

    return 0;
}



